



<?
if(!isset($send))
{
	$r = Q1("select * from language  limit 1");
?>
<p>
    <form action="body-langsetting.php" method="post" name="tcptest" enctype='multipart/form-data'>

		


    <fieldset>
    <legend>Language Setting</legend>
    

    <table>
			<tr>
				<td>language 1</td>
				<td><img src='<?=lang1Pic()?>'></td>
				<td><input type='text' name='lang1' value='<?=$r[lang1]?>'></td>
				<td><input type='file' name='lang1Pic' style='width:100px;'></td>
			</tr>
			<tr>
				<td>language 2</td>
				<td><img src='<?=lang2Pic()?>'></td>
				<td><input type='text' name='lang2' value='<?=$r[lang2]?>'></td>
				<td><input type='file' name='lang2Pic' style='width:100px;'></td>
			</tr>
		</table>
    <input type='hidden' name='oldpic1' value='<?=lang1Pic()?>'><input type='hidden' name='oldpic2' value='<?=lang2Pic()?>'>
     <input type='submit' value='submit' name='send'>
    </fieldset>
   
    </form>

</p>
<?
}
else
{	
	include "dbpasswordonly.php";
	if($_FILES["lang1Pic"]["name"] != "")
	{
	$newname = explode(".",$_FILES['lang1Pic']['name']);
	$newname = "lang1Pic.".$newname[(sizeof($newname)-1)];
	@unlink("../imgs/".$_POST['oldpic1']);
	@copy($_FILES["lang1Pic"]["tmp_name"],"../imgs/".strtolower($newname));
	//sleep(3);
	//exit("<script type=\"text/javascript\">window.location='index.php?body=logosetting';</script>");
	}
	if($_FILES["lang2Pic"]["name"] != "")
	{
	$newname = explode(".",$_FILES['lang2Pic']['name']);
	$newname = "lang2Pic.".$newname[(sizeof($newname)-1)];
	@unlink("../imgs/".$_POST['oldpic2']);
	@copy($_FILES["lang2Pic"]["tmp_name"],"../imgs/".strtolower($newname));
	//sleep(3);
	//exit("<script type=\"text/javascript\">window.location='index.php?body=logosetting';</script>");
	}
	
	
	$SQL="update language set lang1 = '$lang1', lang2 = '$lang2'  ";
	mysql_query($SQL) or die(mysql_error());

	exit("<script type=\"text/javascript\">window.location='index.php?body=langsetting&dummy='+(new Date()).getTime();</script>");

}
?>